package junmo.s3caesar.mandu.nhkradionews.data;

import junmo.s3caesar.mandu.nhkradionews.R;
import android.content.Intent;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;

public class News implements OnClickListener {
	
	private static final String CLASSTAG = News.class.getSimpleName();
	
	private String title;
	private String pubDate;
	private String enclosureUrl;
	
	private View convertView;
	
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getPubDate() {
		return pubDate;
	}
	public void setPubDate(String pubDate) {
		this.pubDate = pubDate;
	}
	public String getEnclosureUrl() {
		return enclosureUrl;
	}
	public void setEnclosureUrl(String enclosureUrl) {
		this.enclosureUrl = enclosureUrl;
	}
	
	public View getConvertView() {
		return convertView;
	}
	public void setConvertView(View convertView) {
		this.convertView = convertView;
	}
	
	@Override
	public String toString() {
		return title + "/" + pubDate + "/" + enclosureUrl;
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.news_list_view_id :
			Log.v(CLASSTAG, toString());
			Intent intent = new Intent("junmo.s3caesar.mandu.nhkradionews.NEWS_PLAYER");
			intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
			intent.putExtra("title", getTitle());
			intent.putExtra("enclosureUrl", getEnclosureUrl());
	        v.getContext().startActivity(intent);
			break;
		}
	}

}
